import React, { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'
import {getMessageInfoById} from '../api/message'


export default function Details() {
    const {id} = useParams()
    const [info, setInfo] = useState({})
    useEffect(()=>{
        getMessageInfoById(id).then((res)=>{
            setInfo(res)
        })
    },[id])


    return (
        <div>
            <h3>{info.title}</h3>
            <p>{info.content}</p>
        </div>
    )
}
